package com.rabbiter.oes.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
@EnableKnife4j
public class Knife4jConfig {

    @Bean
    public Docket adminApiConfig() {

        Docket adminApi = new Docket(DocumentationType.SWAGGER_2).enable(true).groupName("api").apiInfo(apiInfo()).select()
                //扫描哪个包
                .apis(RequestHandlerSelectors.basePackage("com.rabbiter.oes"))
                //哪个请求路径
                .paths(PathSelectors.any()).build();
        return adminApi;
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("在线考试与成绩管理系统-API文档").description("本文档描述了后台管理系统微服务接口定义").version("1.0").contact(new Contact("owen", "http://127.0.0.1:9201", "3141739452@qq.com")).build();
    }

}


